from django.shortcuts import render
from django.http.response import HttpResponse

def set_cookie(request):
    """设置cookie"""
    response = HttpResponse("set_cookie")
    print("设置成功。。。")
    response.set_cookie("name","xiaoming", max_age=20)
    return response


def get_cookie(request):
    """获取cookie"""
    print("获取成功。。。。")
    print(request.COOKIES.get("name"))
    return HttpResponse("get_cookie")


def del_cookie(request):
    """删除cookie"""
    response = HttpResponse("get_cookie")
    response.set_cookie("name","xiaoming",max_age=0)
    print("删除")
    return response